<%@ page language="java" pageEncoding="UTF-8"
         contentType="text/html;charset=utf-8" %>
<%@ include file="/taglibs.jsp" %>
<script type="text/javascript" src="${ctx}/js/easy_validator.pack.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.bgiframe.min.js"></script>
<script type="text/javascript"
        src="${ctx }/resource/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript"
        src="${ctx}/resource/admin/js/ajaxfileupload.js"></script>
<link href="${ctx}/css/validate.css" rel="stylesheet" type="text/css"/>
<html>
<head>
    <title>专家认证信息</title>
</head>
<body>
<form id="form1" name="form1" action="" method="post">
    <input type="hidden" value="${param.flag }" name="flag"/> <input
        type="hidden" value="${map.id }" name="id" id="id"/>
    <center>
        <table class="mobile" style="width: 95%;">
            <tr class="pageheader">
                <td colspan="2"><strong>专家认证信息</strong></td>
            </tr>
            <tr height="25">
                <td class="outDetail" style="width: 30%">专家名称： <label
                        style="font-weight: bold; color: red"> </label></td>
                <td class="outDetail2"><input type="text" id="expertName"
                                              value="${map.expertName }" name="expertName"/></td>
            </tr>
            <tr height="25">
                <td class="outDetail" style="width: 30%">古玩鉴赏证书： <label
                        style="font-weight: bold; color: red"> </label></td>
                <td class="outDetail2"><input id="f_fileImg0" name="cmfile"
                                              onchange="triggerUploadImg0(this);" title="选择图片" type="file">
                    <input class="text" type="hidden" name="picture1"
                           id="bbbbbImg0" value="${map.picture1 }"> <c:if
                            test="${map.picture1!=null }">
                        <img style='width:100px;' src="${ctx }/${map.picture1}"
                             id="aaaaaImg0"/>
                    </c:if></td>
            </tr>
            <tr height="25">
                <td class="outDetail" style="width: 30%">古玩营业执照： <label
                        style="font-weight: bold; color: red"> </label></td>
                <td class="outDetail2"><input id="f_fileImg1" name="cmfile"
                                              onchange="triggerUploadImg1(this);" title="选择图片" type="file">
                    <input class="text" type="hidden" name="picture2"
                           id="bbbbbImg1" value="${map.picture2 }"> <c:if
                            test="${map.picture2!=null }">
                        <img style='width:100px;' src="${ctx }/${map.picture2}"
                             id="aaaaaImg1"/>
                    </c:if></td>
            </tr>
            <tr height="25">
                <td class="outDetail" style="width: 30%">专家认证理由： <label
                        style="font-weight: bold; color: red"> </label></td>
                <td class="outDetail2"><textarea rows="5" id="content"
                                                 cols="50" name="content">${map.content }</textarea></td>
            </tr>
            <tr height="25">
                <td class="outDetail" style="width: 30%">状态： <label
                        style="font-weight: bold; color: red"> </label></td>
                <td class="outDetail2"><input type="text" id="status" value="${map.status}" name="status" readonly/></td>
            </tr>
            <c:if test="${1==1 }"></c:if>
        </table>
    </center>
    <p align="center">
        <br>
        <c:if test="${param.method!='show' }">
            <input type="button" class="btn" value="保  存" onclick="save(this);"/>
        </c:if>
        <input type="button" class="btn" value="关  闭"
               onclick="window.close();"/>
    </p>
</form>
</body>
<script type="text/javascript">
    function save(src) {
        $.post("editSave.html", $("#form1").serializeArray(),
            function (result) {
                result = eval("(" + result + ")");
                if (result.status == "true" || result.status == true) {
                    alert('成功');
                    saveAnd();
                } else {
                    alert('保存失败，请重试');
                }
            }
        );
    }

    function triggerUploadImg0(src) {
        $.ajaxFileUpload({
            url: '${ctx}/file/upload.json',
            secureuri: false,
            fileElementId: 'f_fileImg0',
            dataType: 'json',
            data: {
                fileloc: 'upload/',
                dir: 'temp'
            },
            success: function (data, status) {
                $("#bbbbbImg0").val(data.data.filepath);
                $("#aaaaaImg0").remove();
                $("#bbbbbImg0").after("<img  id='aaaaaImg0' style='width:100px;' src='${ctx}/" + data.data.filepath + "' />");
            },
            error: function (data, status, e) {
                alert('文件上传失败');
            }
        });
    }

    function triggerUploadImg1(src) {
        $.ajaxFileUpload({
            url: '${ctx}/file/upload.json',
            secureuri: false,
            fileElementId: 'f_fileImg1',
            dataType: 'json',
            data: {
                fileloc: 'upload/',
                dir: 'temp'
            },
            success: function (data, status) {
                $("#bbbbbImg1").val(data.data.filepath);
                $("#aaaaaImg1").remove();
                $("#bbbbbImg1").after("<img  id='aaaaaImg1' style='width:100px;' src='${ctx}/" + data.data.filepath + "' />");
            },
            error: function (data, status, e) {
                alert('文件上传失败');
            }
        });
    }

    function triggerUploadImg2(src) {
        $.ajaxFileUpload({
            url: '${ctx}/file/upload.json',
            secureuri: false,
            fileElementId: 'f_fileImg2',
            dataType: 'json',
            data: {
                fileloc: 'upload/',
                dir: 'temp'
            },
            success: function (data, status) {
                $("#bbbbbImg2").val(data.data.filepath);
                $("#aaaaaImg2").remove();
                $("#bbbbbImg2").after("<img  id='aaaaaImg2' style='width:100px;' src='${ctx}/" + data.data.filepath + "' />");
            },
            error: function (data, status, e) {
                alert('文件上传失败');
            }
        });
    }

    function triggerUploadImg3(src) {
        $.ajaxFileUpload({
            url: '${ctx}/file/upload.json',
            secureuri: false,
            fileElementId: 'f_fileImg3',
            dataType: 'json',
            data: {
                fileloc: 'upload/',
                dir: 'temp'
            },
            success: function (data, status) {
                $("#bbbbbImg3").val(data.data.filepath);
                $("#aaaaaImg3").remove();
                $("#bbbbbImg3").after("<img  id='aaaaaImg3' style='width:100px;' src='${ctx}/" + data.data.filepath + "' />");
            },
            error: function (data, status, e) {
                alert('文件上传失败');
            }
        });
    }

    function triggerUpload(src) {
        $.ajaxFileUpload({
            url: '${ctx}/file/upload.json',
            secureuri: false,
            fileElementId: 'f_file',
            dataType: 'json',
            data: {
                fileloc: 'upload/',
                dir: 'temp'
            },
            success: function (data, status) {
                $("input[name='img']").val(data.data.filepath);
                $("#imgUrlShow").attr("src",
                    "${ctx}/" + data.data.filepath + "");
            },
            error: function (data, status, e) {
                alert('文件上传失败');
            }
        });
    }
</script>
</html>
